import { createApp } from 'vue';
import ElementPlus from 'element-plus';
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import 'element-plus/dist/index.css';
import locale from 'element-plus/es/locale/lang/zh-cn';
import App from './App.vue';
import router from './router';
import store from './store';
import 'virtual:svg-icons-register';

// 注册指令
import directive from './directive'; // directive
import plugins from './plugins'; // plugins
import './permission';  // permission control

const app = createApp(App);

// 全局方法挂载
app.config.globalProperties.parseTime = parseTime;
app.config.globalProperties.isEmpty = isEmpty;

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

app.use(plugins);
directive(app);

// 使用element-plus 并且设置全局的大小
app.use(ElementPlus, {
  locale: locale,
  // 支持 large、default、small
  size: Cookies.get('size') || 'default'
})

app.use(router).use(store).mount('#app')
